<#assign module="driver"/>

<@override name="header">
<link rel="stylesheet" href="${ctx}/assets/css/datetimepicker.css">
<link rel="stylesheet" href="${ctx}/assets/css/bootstrap-switch.min.css">
<link rel="stylesheet" href="${ctx}/assets/css/jquery.Jcrop.css">
<style>
	/* autocomplete */
	div.ac {border: 1px solid #ccc;position: absolute;display: none;overflow: auto;background-color: #ffffff;z-index:998;}
	div.ac > ul {margin-top:10px;padding:0;}
	div.ac > ul > li {height:33px;line-height:33px;cursor:pointer;}
	div.ac > ul > li:hover{background:#eee;}
	div.ac > ul > li > div span {padding-left:15px;}
	div.ac > ul > li > div span em {color:red;font-style: normal;}
</style>
</@override>
<@override name="body">
	<div class="row">
		<div class="col-md-12">
			<div class="tabbable"> <!-- Only required for left/right tabs -->
				<ul class="nav nav-tabs">
				    <li class="active"><a href="#versionInfo" data-toggle="tab">版本信息</a></li>
				    <li><a href="#updateInfo" data-toggle="tab">历史信息</a></li>
				</ul>
				<div class="tab-content">
				
					<!--版本信息-->
		    		<div class="tab-pane in active" id="versionInfo">
						<div class="row">
						 	<div class="col-xs-12">
								
							</div>
						</div>
						<div class="row margin-top">
							<div class="col-xs-12">
								<div class="panel panel-primary">
									<div class="table-responsive">
										<table class="table table-hover table-striped">
											<thead>
												<tr style="font-size:14px;">
													<th>设备</th>
													<th>标题</th>
													<th>显示版本号</th>
													<th>比较版本号</th>
													<th>下载地址</th>
													<th>是否强制更新</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
											<#if content?? >
										  	<#list content as data>
												<tr>
													<td>
														<#if data.appVersionType=='androiddriver'>
								                    		安卓司机端
								                    	<#elseif data.appVersionType=='androidcustomer'>
								                    		安卓客户端
								                    	<#elseif data.appVersionType=='iosdriver'>
								                    		ios司机端
								                    	<#elseif data.appVersionType=='ioscustomer'>
								                    		ios客户端
								                    	<#else>
								                    		未知
								                    	</#if>						
													</td>
													<td>
														${data.title?if_exists}
													</td>
													<td>${data.shortversion?if_exists}</td>
													<td>${data.buildversion?if_exists}</td>
													<td><a href="${data.downloadurl?if_exists}" target="_blank">${data.downloadurl?if_exists}</a></td>
													<td>${data.mandatory?string('是','否')}</td>
													<td>
														<a href="${ctx}/appversion/edit/${data.appVersionType}" class="btn-link">编辑</a>
													</td>
												</tr>
											</#list>
											</#if>
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div><!--id="versionInfo"-->
					
					<!--历史信息-->
					<div class="tab-pane in" id="updateInfo">
						<div class="row" style="margin-top: 10px;margin-right: 2px;margin-bottom: -10px;">
							<button class="pull-right btn btn-primary addUpdateInfo" type="button" ><i class="icon-plus"></i>&nbsp;添加历史版本信息</button>
						</div>
						<div class="row margin-top">
							<div class="col-xs-12">
								<div class="panel panel-primary">
									<div class="table-responsive">
										<table class="table table-hover table-striped">
											<thead>
												<tr style="font-size:14px;">
													<th>设备</th>
													<th>版本信息</th>
													<th>上线时间</th>
													<th>应用大小(KB)</th>
													<th>MD5校验值</th>
													<th>服务器接入信息</th>
													<th>功能及用途</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
											<#if updateContent?? >
										  	<#list updateContent as data>
												<tr>
													<td>
														<#if data.appType== 1>
								                    		安卓司机端
								                    	<#elseif data.appType== 2>
								                    		安卓客户端
								                    	<#elseif data.appType== 3>
								                    		ios司机端
								                    	<#elseif data.appType== 4>
								                    		ios客户端
								                    	<#else>
								                    		未知
								                    	</#if>						
													</td>
													<td>${data.version?if_exists}</td>
													<td>${data.onlineTime?string("yyyy-MM-dd")}</td>
													<td>${data.size?if_exists}</td>
													<td>${data.md5Code?if_exists}</td>
													<td>${data.serverInfo?if_exists}</td>
													<td>${data.instructions?if_exists}</td>
													<td>
														<a href="${ctx}/appversion/editUpdateInfo/${data.id}" class="btn-link">编辑</a>
														<a class="btn-link" id="delete" onclick="deleteUpdateInfo(${data.id})">删除</a>
													</td>
												</tr>
											</#list>
											</#if>
											</tbody>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div><!--id="updateInfo"-->
					
				</div><!--class="tab-content"-->
			</div><!--class="tabbable"-->
		</div>
	</div><!--class="row"-->
	
</@override>
<@override name="footer">
<script src="${ctx}/assets/js/bootstrap-switch.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.min.js"></script>
<script src="${ctx}/assets/js/bootstrap-datetimepicker.zh-CN.js"></script>
<script src="${ctx}/assets/js/ajaxfileupload.js"></script>
<script src="${ctx}/assets/js/swfobject.js"></script>
<script src="${ctx}/assets/js/jquery.Jcrop.js"></script>
<script src="${ctx}/assets/js/jquery.autocomplete.min.js"></script>

<script type="text/javascript">
$(document).ready(function(){
	//跳转添加历史信息页面
	$(".addUpdateInfo").click(function(){
		window.location.href = "${ctx}/appversion/addUpdateInfoPage";
	})
})

//删除历史信息记录
function deleteUpdateInfo(id){
	 $.get("${ctx}/appversion/deleteUpdateInfo/"+id,function(data){
        if(data.success){
        	window.location.href = "${ctx}/appversion/list";
        }else{
        	alert("删除失败");
        }
     },'json'); 
}



</script>
</@override>
<@extends name="../layout.ftl"/>
